package com.dou.service.impl;

import com.dou.dao.SeckillOrderStempDao;
import com.dou.entity.SeckillOrderStemp;
import com.dou.service.SeckillOrderStempService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (SeckillOrderStemp)表服务实现类
 *
 * @author makejava
 * @since 2020-03-20 10:52:01
 */
@Service("seckillOrderStempService")
public class SeckillOrderStempServiceImpl implements SeckillOrderStempService {
    @Resource
    private SeckillOrderStempDao seckillOrderStempDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SeckillOrderStemp queryById(Integer id) {
        return this.seckillOrderStempDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<SeckillOrderStemp> queryAllByLimit(int offset, int limit) {
        return this.seckillOrderStempDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param seckillOrderStemp 实例对象
     * @return 实例对象
     */
    @Override
    public SeckillOrderStemp insert(SeckillOrderStemp seckillOrderStemp) {
        this.seckillOrderStempDao.insert(seckillOrderStemp);
        return seckillOrderStemp;
    }

    /**
     * 修改数据
     *
     * @param seckillOrderStemp 实例对象
     * @return 实例对象
     */
    @Override
    public SeckillOrderStemp update(SeckillOrderStemp seckillOrderStemp) {
        this.seckillOrderStempDao.update(seckillOrderStemp);
        return this.queryById(seckillOrderStemp.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.seckillOrderStempDao.deleteById(id) > 0;
    }

    @Override
    public List<SeckillOrderStemp> queryAll(SeckillOrderStemp seckillOrderTemp) {
        return seckillOrderStempDao.queryAll(seckillOrderTemp);
    }

    @Override
    public int getCount(SeckillOrderStemp seckillOrderStemp) {
        return seckillOrderStempDao.getCount(seckillOrderStemp);
    }
}